${rootData.put('pageCard', 'projectInfo')}
<script src="//files.hasor.net/static/javascript/jquery.plugins/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
<link href="//files.hasor.net/static/javascript/jquery.plugins/jquery-ui-1.12.1.custom/jquery-ui.min.css" rel="stylesheet"/>
<#include "/control/editor_md.htm"/>
<link rel="stylesheet" href="${ctx_path}/static/website/css/my_projects.htm.css">
<!-- -->
<#assign readonlyStyle = "readonly='readonly'"/>
<#assign publishReadonlyStyle = ""/>
<#if versionUtils.isPublish(version)>
    <#assign publishReadonlyStyle = "readonly='readonly'"/>
</#if>
<!-- -->
<form id="versionForm" action="${ctx_path}/my/updateVersion.htm" method="post">
    <!-- 详情 -->
    <div class="panel panel-default">
        <input name="id" type="hidden" value="${version.id}"/>
        <input name="projectID" type="hidden" value="${project.id}"/>
        <div class="panel-heading">
            <h3 class="panel-title">
                <a href="${ctx_path}/my/projects.htm?curProjectID=${project.id}">${project.name} - ${version.version}</a> 版本信息
                <#if versionUtils.canUpdateInfo(version) && projectUtils.canVersion(project)>
                    <#assign readonlyStyle = ""/>
                    <a href="javascript:void(0)"><span class="badge flowRight" onclick="versionForm.submit();">更新</span></a>
                </#if>
                <#if versionUtils.isDelete(version) >
                    <span class="label label-warning flowRight">版本已被删除</span>
                </#if>
            </h3>
        </div>
        <div class="panel-body">
            <div class="input-group">
                <span class="input-group-addon">标题</span>
                <input name="subtitle" ${readonlyStyle} ${publishReadonlyStyle} type="text" class="form-control" placeholder="请输入..." value="${version.subtitle}"/>
                <span class="input-group-addon">
                    <input name="contentFormatType" type="hidden" value="${version.changelogFormat.type}"/>
                    ${version.changelogFormat.desc}
                </span>
            </div>
            <div class="input-group">
                <span class="input-group-addon">版本</span>
                <input name="version" ${readonlyStyle} ${publishReadonlyStyle} type="text" class="form-control" placeholder="curent version is ${version.version}" value="${version.version}"/>
            </div>
            <div class="input-group">
                <span class="input-group-addon">下载</span>
                <input name="downloadURL" ${readonlyStyle} type="text" class="form-control" placeholder="http://" value="${version.futures.downloadURL}"/>
                <span class="input-group-addon">
                    <a href="#"><span class="glyphicon glyphicon-eye-open"></span></a>
                </span>
            </div>
            <div class="input-group">
                <span class="input-group-addon">源码</span>
                <input name="sourceURL" ${readonlyStyle} type="text" class="form-control" placeholder="http://" value="${version.futures.sourceURL}"/>
                <span class="input-group-addon">
                    <a href="#"><span class="glyphicon glyphicon-eye-open"></span></a>
                </span>
            </div>
            <div class="input-group">
                <span class="input-group-addon">手册</span>
                <input name="apiURL" ${readonlyStyle} type="text" class="form-control" placeholder="http://" value="${version.futures.apiURL}"/>
                <span class="input-group-addon">
                    <a href="#"><span class="glyphicon glyphicon-eye-open"></span></a>
                </span>
            </div>
            <div class="input-group">
                <#if versionUtils.canPublish(version) >
                    <script>
                        $(function () {
                            $("#releaseTime").datepicker({dateFormat: "yy-mm-dd", defaultDate: $("#releaseTime").val()});
                        });
                    </script>
                    <style>
                        .ui-datepicker {
                            z-index: 99999 !important
                        }
                    </style>
                </#if>
                <span class="input-group-addon">发布时间</span>
                <input id="releaseTime" name="releaseTime" ${readonlyStyle} ${publishReadonlyStyle} type="text" class="form-control" placeholder="YYYY-MM-DD" value="${version.releaseTime?string('yyyy-MM-dd')}"/>
                <span class="input-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                </span>
            </div>
            <script>
                $(function () {
                    initEditor("changelogEditor");
                });
            </script>
            <div id='changelogEditor'>${version.changelog}</div>
            <div class="input-group">
                <span class="input-group-addon">当前状态</span>
                <span class="form-control">
                    <#list versionStatusList as statusItem>
                        <#assign styleName = "label-default"/>
                        <#if version.status?? && version.status.type == statusItem.type>
                            <#assign styleName = "label-success"/>
                        </#if>
                        <span class="col-sm-1 label ${styleName} rightMargin">${statusItem.desc}</span>
                    </#list>
                </span>
            </div>
            <div class="input-group">
                <span class="input-group-addon">创建时间</span>
                <input type="text" class="form-control" value="${version.createTime?string('yyyy-MM-dd HH:mm:ss')}" readonly="readonly"/>
            </div>
            <div class="input-group">
                <span class="input-group-addon">修改时间</span>
                <input type="text" class="form-control" value="${version.modifyTime?string('yyyy-MM-dd HH:mm:ss')}" readonly="readonly"/>
            </div>
        </div>
    </div>
</form>
<!-- 操作 -->
<#if version.status.type != -1 && projectUtils.canVersion(project)>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">高级操作</h3>
        </div>
        <div class="panel-body">
            <#if versionUtils.canDelete(version) && projectUtils.canVersion(project)>
                [<a title="删除，7天后将正式删除" href="${ctx_path}/my/operateVersion.do?projectID=${project.id}&versionID=${version.id}&method=delete&target=detail">
                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>&nbsp;删除项目</a>]
            </#if>
            <#if versionUtils.canPublish(version) && projectUtils.canVersion(project)>
                [<a title="发布" href="${ctx_path}/my/operateVersion.do?projectID=${project.id}&versionID=${version.id}&method=publish&target=detail">
                <span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span>&nbsp;版本发布</a>]
            </#if>
            <#if versionUtils.canRecovery(version) && projectUtils.canVersion(project)>
                [<a title="取消删除操作" href="${ctx_path}/my/operateVersion.do?projectID=${project.id}&versionID=${version.id}&method=recover&target=detail">
                <span class="glyphicon glyphicon-ban-circle" aria-hidden="true"></span>&nbsp;撤销删除</a>]
            </#if>
        </div>
    </div>
</#if>